// 引入windi css
import '@/plugins/windi.css'

// 导入全局的svg图标
import '@/plugins/svgIcon'

// 引入状态管理
import { setupStore } from '@/store'

// 全局组件
import { setupGlobCom } from '@/components'

// 引入element-plus
import { setupElementPlus } from '@/plugins/elementPlus'

// 引入全局样式
import '@/styles/index.less'

// 引入动画
import '@/plugins/animate.css'
// 路由
import { setupRouter } from './router'
import { createApp } from 'vue'
import App from './App.vue'
import './permission'
import {useCache} from "@/hooks/web/useCache";
import { usePermissionStore } from "@/store/modules/permission";
import print from 'vue3-print-nb'
//引入无界
const handlerWujie=async ()=>{
  console.log("starting from wujie....")
  // @ts-ignore
  if(window.$wujie.props.doLogin)return;
  const permissionStore = usePermissionStore();
  await permissionStore.getRouterResources();
  const {wsCache}=useCache();
  let redirect=permissionStore.addRouters[0].path;
  // @ts-ignore
  if(wsCache.get(window.$wujie.props.appName+"_currRouter")) {
    // @ts-ignore
    redirect = wsCache.get(window.$wujie.props.appName + "_currRouter");
  }
  // @ts-ignore
  const {push} = window.$router;
  push({path:redirect})
}
const setupAll = async () => {
  const app = createApp(App)

  setupStore(app)

  setupGlobCom(app)

  setupElementPlus(app)

  setupRouter(app)

  app.use(print);

  app.mount('#app');
  // @ts-ignore
  if(window.__POWERED_BY_WUJIE__)
    handlerWujie();
}
setupAll();



